import { createStore } from 'vuex'
import getters from './getters'

const files = import.meta.globEager('./modules/*.js')

const modules = {}

for (const key in files) {
    if (Object.prototype.hasOwnProperty.call(files, key)) {
        modules[key.replace(/(\.\/|\.js)/g, '').replace('modules/', '')] = files[key].default
    }
}

const store = createStore({
    modules,
    getters
})

export default store